
// @dart=io

import 'package:flutter/foundation.dart' show kIsWeb;

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_storage/get_storage.dart';
import 'package:osg/controllers/http.dart';
import 'package:osg/controllers/my_method.dart';


 
import 'kong.dart' if (dart.library.io) 'package:osg/middleware/im_manager.dart';

 
import './routers/routers.dart';
import "package:get/get.dart";
import 'bindding/web3.dart';


    // TencentImSDKPlugin.v2TIMManager.initSDK(
    //     sdkAppID: sdkAppID, // SDKAppID
    //     loglevel: LogLevelEnum.V2TIM_LOG_ALL, // 日志登记等级
    //     listener: sdkListener, // 事件监听器
    //   )
   

 

void main() async{
  await GetStorage.init();

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  // This widget is the root of your application.
  
  @override
  State<MyApp> createState() =>  _MyHomePageState();

}

 _initim() async{
    await ImManager().init();
 }
 


class _MyHomePageState extends State<MyApp> {


  @override
  void initState() {
    // TODO: implement initState
    super.initState();
   if(!kIsWeb){
      _initim();
   }
  }
  
  @override
  Widget build(BuildContext context) {
      SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarIconBrightness: Brightness.dark, // 将状态栏图标颜色设置为亮色（白色）
      statusBarBrightness: Brightness.dark, // 这通常用于iOS，设置状态栏亮度，但请注意iOS 13及以后不再需要此属性，因为系统会自动调整以符合暗模式或亮模式
    ));
    return GetMaterialApp(
      // home:MyHomePage(title: 'Tencent Cloud Chat UIKit'),
      initialBinding: WebControllerBinding(),
        debugShowCheckedModeBanner: false,
        title: 'OSG',
        theme: ThemeData(
          splashColor: const Color.fromARGB(0, 63, 35, 35),
          primarySwatch: Colors.blue,
          scaffoldBackgroundColor: const Color.fromARGB(255, 255, 255, 255), // 页面背景色
        ),
        
        initialRoute:'/login/splash_screen',

        // initialRoute: '/',
        defaultTransition: Transition.rightToLeft,
        getPages: AppPage.routes);
  }

 
}
 